{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>{% block title %}主页{% endblock %}</title>
  <!-- Tell the browser to be responsive to screen width -->
  <!-- script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js" -->
  <script src="{% static 'js/jquery.min.js' %}"></script>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdn.bootcss.com/ionicons/4.0.0-9/css/ionicons.min.css">
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
  {% block css %}
  <!-- DataTables -->
  <link rel="stylesheet" href="{% static 'plugins/datatables/dataTables.bootstrap.min.css' %}">
  <!-- Theme style -->
  <link rel="stylesheet" href="{% static 'dist/css/AdminLTE.min.css' %}">
  <!-- AdminLTE Skins. Choose a skin from the css/skinsfolder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="{% static 'dist/css/skins/_all-skins.min.css' %}">
  <script src="../static/js/myjs.js"></script>
  {% endblock %}
</head>
<body class="hold-transition skin-blue sidebar-mini {% if request.session.bar == 1 %} sidebar-collapse {% endif %}">
  <div class="wrapper">
    <header class="main-header">
    <!-- Logo -->
      <a href="#" class="logo">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini">领骏</span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg"><b>领骏CMDB</b></span>
      </a>
      <!-- Header Navbar: style can be found in header.less -->
      <nav class="navbar navbar-static-top" role="navigation">
        <!-- Sidebar toggle button-->
        <a href="#" id="sidebar-toggle" class="sidebar-toggle" data-toggle="push-menu" role="button">
          <span class="sr-only">Toggle navigation</span>
        </a>
        <div class="navbar-custom-menu">
          <ul class="nav navbar-nav">
            <!-- Messages: style can be found in dropdown.less-->
            <li class="dropdown messages-menu">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-envelope-o"></i>
                <span class="label label-success">0</span>
              </a>
              <ul class="dropdown-menu">
                <li class="header">此功能暂缺</li>
              </ul>
            </li>
            <!-- Notifications: style can be found in dropdown.less -->
            <li class="dropdown notifications-menu">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-bell-o"></i>
                <span class="label label-warning">0</span>
              </a>
              <ul class="dropdown-menu">
                <li class="header">此功能暂缺</li>
              </ul>
            </li>
            <!-- Tasks: style can be found in dropdown.less -->
            <li class="dropdown tasks-menu">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-flag-o"></i>
                <span class="label label-danger">0</span>
              </a>
              <ul class="dropdown-menu">
                <li class="header">此功能暂缺</li>
              </ul>
            </li>
          <!-- 用户信息: style can be found in dropdown.less -->
            <li class="dropdown user user-menu">
              <a href={% url 'userinfo' %}>
                <img src="/static/dist/img/user2-160x160.jpg" class="user-image" alt="User Image">
                <span class="hidden-xs">{{ user.username }}</span>
              </a>
             <li class="dropdown">
              <a href=/logout/>
              <i class="fa fa-power-off"></i> <span>退出</span>
              </a>
             </li>
            </li>
          <!-- Control Sidebar Toggle Button -->
          </ul>
        </div>
      </nav>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- Sidebar user panel -->
      <div class="user-panel">
        <div class="pull-left image">
          <img src="/static/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
        </div>
        <div class="pull-left info">
          <p>{{ user.username }}</p>
          <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
        </div>
      </div>
      <!-- search form -->
      <form action="#" method="get" class="sidebar-form">
        <div class="input-group">
          <input type="text" name="q" class="form-control" placeholder="Search...">
              <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
        </div>
      </form>
      <!-- /.search form -->
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu" data-widget="tree">
        <li class="header">导航栏</li>
        <li class="{% if request.path == '/' %} active {% endif %}">
          <a href={% url 'dashboard' %}>
            <i class="fa fa-dashboard"></i> <span>Dashboard</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
        </li>
        <li class="{% if request.path == '/server/' %} active {% endif %}">
          <a href={% url 'server' %}>
            <i class="fa fa-server"></i> <span>服务器</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
         </li>
        <li class="{% if request.path == '/networkdevice/' %} active {% endif %}">
          <a href={% url 'networkdevice' %}>
            <i class="fa fa-sitemap"></i> <span>网络设备</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
        </li>
        <li class="{% if request.path == '/circuit/' %} active {% endif %}">
          <a href='#'>
            <i class="fa fa-connectdevelop"></i> <span>波分管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
        </li>
        <li class=" {% if request.path == '/datacenter/' or request.path == '/cabinet/' %} active menu-open treeview {% else %} treeview {% endif %}">
          <a href="#">
            <i class="fa fa-building"></i> <span>机房管理</span>
            <span class="pull-right-container">
            <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li class="{% if request.path == '/datacenter/' %} active {% endif %}"><a href={% url 'datacenter' %}><i class="fa fa-circle-o"></i> 机房管理</a></li>
            <li class="{% if request.path == '/cabinet/' %} active {% endif %}"><a href={% url 'cabinet' %}><i class="fa fa-circle-o"></i> 机架管理</a></li>
          </ul>
        </li>
        <li class="{% if request.path == '/circuit/' %} active {% endif %}">
          <a href='#'>
            <i class="fa fa-object-ungroup"></i> <span>专线管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
        </li>
        <li class=" {% if request.path == '/ipnet/' or request.path == '/ipaddress/' %} active menu-open treeview {% else %} treeview {% endif %}">
          <a href="#">
            <i class="fa  fa-ra"></i> <span>IP网段管理</span>
            <span class="pull-right-container">
            <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li class="{% if request.path == '/ipnet/' %} active {% endif %}"><a href={% url 'ipnet' %}><i class="fa fa-circle-o"></i> 网段管理</a></li>
            <li class="{% if request.path == '/ipaddress/' %} active {% endif %}"><a href={% url 'ipaddress' %}><i class="fa fa-circle-o"></i> IP管理</a></li> 
          </ul> 
        </li>
        <li class="{% if request.path == '/userinfo/' %} active {% endif %}">
          <a href={% url 'userinfo' %}>
            <i class="fa fa-user"></i> <span>用户管理</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
         </li>
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">

      {#        主体内容全放到这里！#}
      {% block content %}{% endblock %}

  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="pull-right hidden-xs">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2018-领骏驰联.</strong> All rights reserved.
  </footer>

</div>
<!-- ./wrapper -->

<script>
$("#sidebar-toggle").click(function(){
    $.get('/ajax_bar', function(ret){
        });            
})
</script>

<!-- jQuery UI 1.11.4 -->
<script src="/static/plugins/jQueryUI/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<!-- Bootstrap 3.3.6 -->
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="https://cdn.bootcss.com/jquery-sparklines/2.1.2/jquery.sparkline.min.js"></script>
{% block script %}
<!-- DataTables -->
<script src="{% static 'plugins/datatables/jquery.dataTables.min.js' %}"></script>
<script src="{% static 'plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
<!-- SlimScroll -->
<script src="{% static 'plugins/slimScroll/jquery.slimscroll.min.js' %}"></script>
<!-- FastClick -->
<script src="{% static 'plugins/fastclick/fastclick.min.js' %}"></script>
<!-- AdminLTE App -->
<script src="https://cdn.bootcss.com/admin-lte/2.4.2/js/adminlte.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="{% static 'dist/js/demo.js' %}"></script>
<!-- Sparkline -->
<script src="https://cdn.bootcss.com/jquery-sparklines/2.1.2/jquery.sparkline.min.js"></script>
<!-- page script -->
<script>
  $(function () {
    $('#assets_table').DataTable({
      "paging": true,       <!-- 允许分页 -->
      "lengthChange": true, <!-- 允许改变每页显示的行数 -->
      "searching": true,    <!-- 允许内容搜索 -->
      "ordering": true,     <!-- 允许排序 -->
      "info": true,         <!-- 显示信息 -->
      "autoWidth": false    <!-- 固定宽度 -->
    });
  });
</script>
{% endblock %}
{% if messages %}
<script>
    {% for msg in messages %}
        alert('{{ msg.message }}');
    {% endfor %}
</script>
{% endif %}
</body>
</html>
